/**
 * 
 */
package org.apache.struts2.gtgrid.views.jsp.ui;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts2.components.Component;
import org.apache.struts2.gtgrid.components.Head;
import org.apache.struts2.views.jsp.ui.AbstractUITag;

import com.opensymphony.xwork2.util.ValueStack;

/**
 * 
 * 
 * @author Stevie
 * @since 2009-12-1
 * @version 1.0
 * 
 */
public class HeadTag extends AbstractUITag {
	private static final long serialVersionUID = 7718148826911446707L;

	private String gtGridCss;
	private String debug;
	private String locale;
	
	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * org.apache.struts2.views.jsp.ComponentTagSupport#getBean(com.opensymphony
	 * .xwork2.util.ValueStack, javax.servlet.http.HttpServletRequest,
	 * javax.servlet.http.HttpServletResponse)
	 */
	@Override
	public Component getBean(ValueStack stack, HttpServletRequest req,
			HttpServletResponse res) {
		return new Head(stack, req, res);
	}

	protected void populateParams() {
		super.populateParams();
		if (gtGridCss != null) {
			((Head) component).setGtGridCss(gtGridCss);
		}
		if (locale != null) {
			((Head) component).setLocale(locale);
		}
		if (debug != null) {
			((Head) component).setDebug(Boolean.valueOf(debug).booleanValue());
		}
	}

	public String getGtGridCss() {
		return gtGridCss;
	}

	public void setGtGridCss(String gtGridCss) {
		this.gtGridCss = gtGridCss;
	}

	public void setDebug(String debug) {
		this.debug = debug;
	}
	
    public void setLocale(String locale) {
        this.locale = locale;
    }
}
